package sg.edu.nus.iss.phoenix.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Swaminathan Subramanian (A0076756)
 * @version 1.0 2012/9/26
 */
public class PhoenixUtils {
	public static boolean isNumeric(String input) {
		try {
			Integer.parseInt(input);
			return true;
		} catch (Exception ex) {
			return false;
		}
	}

	public static Date stringToDate(String date) {
		Date date1 = new Date(System.currentTimeMillis());
		try {
			date1 = new SimpleDateFormat("MM/dd/yy").parse(date);
			return date1;
		} catch (ParseException e) {
			
		}
		return date1;
	}

	public static java.sql.Date convertToSQLDate(Date date) {
		java.sql.Date sqlDate = new java.sql.Date(date.getTime());
		return sqlDate;
	}
	
	public static java.sql.Timestamp convertToSQLTimeStamp(Date date) {
		java.sql.Timestamp sqlDate = new java.sql.Timestamp(date.getTime());
		return sqlDate;
	}
}
